<template>
	<view class="pages">
		<u-navbar title="业务员列表" :autoBack="true" placeholder bgColor="#fff"></u-navbar>
		<view class="content-list" v-for="(item,index) in dataList" :key="index" @click="toPage(item)">
			<view class="" style="font-size: 34rpx;">{{item.PartName}}（{{item.PartNumber}}）</view>
			<view class="phone">
				{{item.OperName}}（{{item.OperNumber}}）
			</view>
		</view>
	</view>
</template>

<script>
	import { getOrderSalesmanList } from '@/api/index'
	export default {
	  data() {
	    return {
				dataList: [],
				orgInfo: {},
	    }
	  },
	  onLoad(options) {
			this.orgInfo = uni.getStorageSync('orgInfo')
			this.dataInfo()
	  },
	  methods: {
			dataInfo() {
				uni.showLoading({ mask: true });
				getOrderSalesmanList({ "parameters": [ {"orgNumber":this.orgInfo.orgId, "FOperatorType":"XSY"} ]}).then(res => {
					if(res.OperatorList[0].IsSuccess) {
						uni.hideLoading();
						this.dataList = res.OperatorList
					} else {
						uni.showToast({
							title: '查询失败',
							icon: 'none'
						});
					}
				})
			},
			toPage(item) {
				// 返回上一页并传递参数
				const pages = getCurrentPages();
				if (pages.length > 1) {
				  const prevPage = pages[pages.length - 2]; // 获取上一页实例
				  // 调用上一页的方法
				  prevPage.$vm.onPageBReturn({ data: item });
				   // 返回上一页
				  uni.navigateBack();
				}
			}
	  },
	}
</script>

<style lang="scss" scoped>
	::v-deep .u-input {
		height: 75rpx;
	}
	.pages{
		width: 750rpx;
		min-height: 100vh;
		padding-bottom: 40rpx;
		.content-list {
			border-bottom: 1px solid #afacac;
			padding: 15rpx 35rpx;
			.phone {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin: 20rpx 0;
				image {
					width: 30rpx;
					height: 30rpx;
				}
			}
		}
	}
</style>